<template>
<h2>权益列表</h2>
<table class="table table-bordered">
    <thead>
        <tr>
            <td>权益编号</td>
            <td>权益名称</td>
            <td>权益图片</td>
            <td>权益状态</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody>
        <tr v-for="item in info">
            <td>{{ item.qid }}</td>
            <td>{{ item.qname }}</td>
            <td><img :src="item.image" style="width: 70px;height: 70px;"/></td>
            <td>{{ item.state?"可用":"不可用" }}</td>
            <td>
                <a href="#" @click="Upd(item.qid)">修改</a>
            </td>
        </tr>
    </tbody>
</table>
</template>

<script setup lang="ts">
import {ref,onMounted} from 'vue'
import axios from 'axios'
import { useRouter } from 'vue-router';
const router=useRouter()

const info=ref([{
    qid:0,
    qname:'',
    image:'',
    state:true
}])

onMounted(()=>{
    Show()
})
//显示
const Show=()=>{
    axios.get('https://localhost:7279/api/Quanyi/QuanyiShow')
    .then(res=>{
        info.value=res.data
    })
    .catch(err=>{
        console.log(err)
    })
}

const Upd=(id:number)=>{
    router.push({
        name:'QuanyiUpd',
        params:{
            id:id
        }
    })
}   



</script>